import { Image, Text, View } from "@tarojs/components";
import { styled } from "linaria/lib/react";
import React, { FC, ReactElement } from "react";
import browse from "../../assets/browse.svg";
import thumbsUp from "../../assets/thumbsUp.svg";
import comment from "../../assets/comment.svg";

interface IProps {
  count: number;
  type: keyof typeof sources;
}

const sources = {
  browse,
  thumbsUp,
  comment
};

const Tag: FC<IProps> = ({ count, type }): ReactElement => {
  return (
    <Container>
      <Image src={sources[type]} />
      <Text>{count}</Text>
    </Container>
  );
};

export default Tag;

const Container = styled(View)`
  width: 3rem;
  height: 1.2rem;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  background: #0d8278;
  border-radius: 10px;
  font-size: 24px;
  color: #fffae5;
  margin: 0.5rem;
  image {
    height: 1rem;
    width: 1rem;
  }
`;
